#! /usr/bin/python3
from threading import Lock

from renderer import Renderer
from game import Game

STEP_RUN = 1
SCREEN_WIDTH = 80
SCREEN_HEIGHT = 50

map_lock = Lock()
game = Game(80, 50)
renderer = Renderer(game, map_lock, SCREEN_WIDTH, SCREEN_HEIGHT)
game.set_functions(renderer.get_next_key)

renderer.start()

while renderer.is_alive() or game.stop == False:
    map_lock.acquire()
    game.run_steps(STEP_RUN)
    map_lock.release()
